Page({

  /**
   * 页面的初始数据
   */
  data: {
    toastHidden: true,
    toastContent: '',
    // 轮播图数组
    imgUrls: ['/images/home_viewpager/hootroom3.jpg', '/images/home_viewpager/hootroom4.jpg',
      '/images/home_viewpager/hootroom5.jpg', '/images/home_viewpager/hootroom6.jpg', '/images/home_viewpager/hootroom7.jpg',
      '/images/home_viewpager/hootroom8.jpg'
    ],
    indicator_dots: true, //是否加载指示点
    // indicator_color: rgb(82, 73, 73),    //指示点颜色
    // indicator_active_color:'bbb',   //当前选中的颜色
    autoplay: true, //是否自动切换
    current: 0, //默认显示的index
    interval: 3000, //切换间隔时长
    duration: 300, //滑动时长
    circular: true, //是否采用衔接滑动
    today_new: [{
      new_imgurl: '/images/home_viewpager/hootroom3.jpg',
      name: "【鲜红大橘子】",
      standards: '6斤',
      current_price: '6.4',
      original_price: '￥8.6',
      new_count_down_day: '00',
      new_count_down_h: '01',
      new_count_down_m: '12',
      new_count_down_s: '22'
    }, {
      new_imgurl: '/images/home_viewpager/hootroom4.jpg',
      name: "【鲜红大苹果】",
      standards: '3斤',
      current_price: '3.4',
      original_price: '￥5.6',
      new_count_down_day: '00',
      new_count_down_h: '01',
      new_count_down_m: '12',
      new_count_down_s: '22'
    }, {
      new_imgurl: '/images/home_viewpager/hootroom5.jpg',
      name: "【鲜红大芒果】",
      standards: '7斤',
      current_price: '12.4',
      original_price: '￥14.6',
      new_count_down_day: '00',
      new_count_down_h: '01',
      new_count_down_m: '12',
      new_count_down_s: '22'
    }, {
      new_imgurl: '/images/home_viewpager/hootroom6.jpg',
      name: "【鲜红大香蕉】",
      standards: '6斤',
      current_price: '16.4',
      original_price: '￥18.6',
      new_count_down_day: '00',
      new_count_down_h: '01',
      new_count_down_m: '12',
      new_count_down_s: '22'
    }],

  },
  // 点击抢购
  to_snap_up(e) {
    var index = e.currentTarget.dataset.index
    var bean = this.data.today_new[index]
    var name = this.data.today_new[index].name
    var new_imgurl = this.data.today_new[index].new_imgurl
    var standards = this.data.today_new[index].standards
    var current_price = this.data.today_new[index].current_price
    var original_price = this.data.today_new[index].original_price
    wx.navigateTo({
      url: "/pages/goods_info/goods_info?new_imgurl=" + new_imgurl + "&name=" + name + "&standards=" + standards + "&current_price=" + current_price + "&original_price=" + original_price
    })

     // this.setData({
    //   toastHidden: false,
    //   toastContent: "去抢购" + str,
    // })
  },
  // 点击轮播图
  pager_itemclick: function(e) {
    var index = e.currentTarget.dataset.index
    // var str = this.data.today_new[index].name
    this.setData({
      toastHidden: false,
      toastContent: "轮播图" + (index + 1),
    })
  },
  toastChange: function() {
    this.setData({
      toastHidden: true
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  }
})